{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 10,
   "metadata": {},
   "outputs": [],
   "source": [
    "from manim import *\n",
    "\n",
    "config.progress_bar = \"none\"\n",
    "config.media_width = \"100%\"\n",
    "# config.media_embed = True\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 11,
   "metadata": {},
   "outputs": [],
   "source": [
    "class CurvedObjects(Scene):\n",
    "    def construct(self):\n",
    "        dot = Dot(color=YELLOW)\n",
    "\n",
    "        circle = Circle(fill_opacity=1, fill_color=ORANGE, stroke_color=YELLOW)\n",
    "\n",
    "        annulus = Annulus(inner_radius=0.5, outer_radius=1.2, fill_color=DARK_BLUE, stroke_color=YELLOW, stroke_width=2)\n",
    "\n",
    "        ellipse = Ellipse(color=YELLOW)\n",
    "\n",
    "        sector = Sector(inner_radius=0.5, outer_radius=1.2, fill_color=DARK_BLUE, stroke_color=YELLOW, stroke_width=2)\n",
    "\n",
    "        arc = Arc(radius=1.3, start_angle=-PI / 8, angle=PI, color=YELLOW)\n",
    "\n",
    "        arc2 = ArcBetweenPoints(start=2 * RIGHT, end=2 * LEFT, stroke_color=YELLOW)\n",
    "\n",
    "        g = VGroup(*[item for _, item in locals().items() if isinstance(item, VMobject)])\n",
    "        g.arrange_in_grid(buff=1)\n",
    "\n",
    "        self.play(*[Create(item) for item in g.submobjects])\n",
    "        self.wait(0.5)\n",
    "        self.play(*[Uncreate(item) for item in g.submobjects])\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 12,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<video src=\"media\\jupyter\\CurvedObjects@2022-03-28@23-19-10.mp4\" controls autoplay loop style=\"max-width: 100%;\"  >\n",
       "      Your browser does not support the <code>video</code> element.\n",
       "    </video>"
      ],
      "text/plain": [
       "<IPython.core.display.Video object>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "%manim -v WARNING -qm CurvedObjects"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 13,
   "metadata": {},
   "outputs": [],
   "source": [
    "class AngleScene(Scene):\n",
    "    def construct(self):\n",
    "        v = ValueTracker(PI / 1000)\n",
    "        line1 = Line()\n",
    "        line2 = Line().rotate(v.get_value())\n",
    "        line2_ref = line2.copy()\n",
    "        line2.add_updater(lambda this: this.become(line2_ref.copy().rotate(v.get_value())))\n",
    "        angle = Angle(line1, line2).set_color_by_gradient([WHITE, BLUE])\n",
    "        angle.add_updater(lambda this: this.become(Angle(line1, line2).set_color_by_gradient([WHITE, BLUE])))\n",
    "        self.add(line1, line2, angle)\n",
    "        self.play(v.animate.set_value(PI * 5 / 4), run_time=3, rate_func=rate_functions.ease_out_bounce)\n",
    "        self.wait()\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 14,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<video src=\"media\\jupyter\\AngleScene@2022-03-28@23-19-11.mp4\" controls autoplay loop style=\"max-width: 100%;\"  >\n",
       "      Your browser does not support the <code>video</code> element.\n",
       "    </video>"
      ],
      "text/plain": [
       "<IPython.core.display.Video object>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "%manim -v WARNING -qm AngleScene"
   ]
  }
 ],
 "metadata": {
  "interpreter": {
   "hash": "2c0948b606a87f16a1329dbdb4c9bf2c1b73f2116240f6b736465dcfd150b23b"
  },
  "kernelspec": {
   "display_name": "Python 3.8.12 ('manim')",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.8.12"
  },
  "orig_nbformat": 4
 },
 "nbformat": 4,
 "nbformat_minor": 2
}
